
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Zookeeper中的Quorum是什么？ - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Zookeeper中的Quorum是什么？ - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">Zookeeper中的Quorum（法定人数）是什么，其核心目的是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Quorum是在Zookeeper集群中执行特定操作（如写入或Leader选举）所需的最小节点数。其核心目的是确保即使部分节点发生故障，集群依然能正常工作，并保障数据的一致性。</div>
          </div>
          <div class="card-source">来源: Quorum 的定义</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在Zookeeper的写操作中，Quorum机制是如何保证数据同步的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">所有写操作都由Leader节点发起，并同步到Follower节点。一个写操作只有在获得大多数（Quorum）节点的确认后，才被认为是成功的，这时Leader才会向客户端返回成功响应。</div>
          </div>
          <div class="card-source">来源: Quorum 的工作原理 > 写操作中的 Quorum</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Zookeeper的Leader选举过程如何依赖Quorum机制来确保选举的正确性？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">为了保证选举过程的正确性，新当选的Leader必须获得集群中大多数（Quorum）节点的支持和同意。这可以有效避免因网络分区或节点故障导致的数据不一致问题。</div>
          </div>
          <div class="card-source">来源: Quorum 的工作原理 > Leader 选举中的 Quorum</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">Quorum机制如何帮助Zookeeper处理网络分区问题，以防止数据不一致？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">当发生网络分区时，只有节点数量达到Quorum的分区才能继续提供服务（如写操作和Leader选举）。其他分区则无法进行这些操作，从而防止了因网络分区导致的数据不一致性。</div>
          </div>
          <div class="card-source">来源: Quorum 对集群可用性和一致性的影响 > 网络分区处理</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在配置Zookeeper集群时，Quorum的大小通常如何设定？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Quorum的数量通常设置为集群节点总数的一半加一，即 (N / 2) + 1。这样的配置可以确保集群在部分节点故障的情况下仍能正常工作。</div>
          </div>
          <div class="card-source">来源: 配置和优化 > 设置 Quorum 大小</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">对于一个5节点的Zookeeper集群，Quorum机制是如何保障其高可用性的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在一个5节点的集群中，Quorum数量为3。即使有2个节点发生故障，剩余的3个节点仍然能够达到Quorum要求，使得集群可以继续提供服务并处理客户端请求。</div>
          </div>
          <div class="card-source">来源: Quorum 对集群可用性和一致性的影响 > 高可用性</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
